class Note < ActiveRecord::Base
  belongs_to :page
  belongs_to :friend
  attr_protected :created_at, :page_id
  
  def content_html
    RedCloth.new(content).to_html(:textile)
  end

  validates_length_of :name, :maximum => 40, :allow_nil => true, :message => _("is too long. %s chars top.", 40)
  validates_length_of :email, :maximum=> 100, :allow_nil => false, :message => _("is too long. %s chars top.", 100)
  validates_length_of :content, :maximum => 357, :allow_nil => false, :message => _("is too long. %s chars top.", 357)

  validates_format_of :name, :with => Format::STRING, :if => Proc.new {|note| !note.name.blank? }, :message => _("is not cool.")
  validates_format_of :email, :with => Format::EMAIL, :message => _("is not cool.")
#  validates_format_of :website, :with => Format::HTTPDOMAIN

end
